package net.lahuobao.mall.entity.admin.resultmodel;

import net.lahuobao.mall.entity.admin.MallProductEntity;
import org.jeecgframework.core.util.StringUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created by clark on 2016/9/28 0028.
 * 商品管理返回实体
 */
public class MallManageProductResultEntity extends MallProductEntity{

    /*店铺名称*/
    private String shopname;

    /**0，平台补贴，1，商户补贴*/
    private Integer subsidysource;
    /**0 不补贴，1 金额，2折扣，3满减*/
    private Integer subsidytype;

    private String strSubsidyval;

    private List<MallSubsidyResultEntity>  subsidyList;

    public List<MallSubsidyResultEntity> getSubsidyList() {
        return subsidyList;
    }

    public void setSubsidyList(List<MallSubsidyResultEntity> subsidyList) {
        this.subsidyList = subsidyList;
    }

    public String getShopname() {
        return shopname;
    }

    public void setShopname(String shopname) {
        this.shopname = shopname;
    }

    public Integer getSubsidysource() {
        return subsidysource;
    }

    public void setSubsidysource(Integer subsidysource) {
        this.subsidysource = subsidysource;
    }

    public Integer getSubsidytype() {
        if(subsidyList.size() > 0){
            subsidytype = subsidyList.get(0).getSubsidytype();
        }else {
            subsidytype = 0;
        }
        return subsidytype;
    }

    public void setSubsidytype(Integer subsidytype) {
        this.subsidytype = subsidytype;
    }

    public String getStrSubsidyval() {
        strSubsidyval = "";
        if(subsidyList.size() > 0){
            /**0 不补贴，1 金额，2折扣，3满减*/
            switch (subsidyList.get(0).getSubsidytype()){
                case 0 :
                    strSubsidyval = 0+"";
                    break;
                case 1 :
                case 2 :
                    strSubsidyval = subsidyList.get(0).getSubsidyval()+"";
                    break;
                case 3 :
                    for(MallSubsidyResultEntity  entity : subsidyList){
                        strSubsidyval += "满"+entity.getMinmoney()+"到"+entity.getMaxmoney()+"减"+entity.getSubsidyval()+",";
                    }
                    break;
            }
        }else {
            this.strSubsidyval = 0+"";
        }
        return strSubsidyval;
    }

    public void setStrSubsidyval(String strSubsidyval) {
        this.strSubsidyval = strSubsidyval;
    }
}
